//
// Decompiled with: Decompiler.NET, Version=1.3.1.18439, Culture=neutral, PublicKeyToken=null, Version: 1.3.1.18439
// Decompilation Started at: 3/15/2009 10:34:26 PM
// Copyright 2003 - 2004, Jungle Creatures, Inc., All Rights Reserved. 
// Written by Jonathan Pierce, Email: support@junglecreatures.com
//

namespace PatientManagement

{
		
		#region Namespace Import Declarations
		
			using System.ComponentModel;
			using System.Data.Common;
			using System.Data;
			using System.Data.SqlClient;
			using System.Drawing;
			using System;
			using System.Resources;
			using System.Windows.Forms;
			using Utility;
			
		#endregion
		
	public class frmXoaHD : Form
	
	{
		
		#region Fields
			private BindingManagerBase bmb;
			private Button btExit;
			private Button btFirst;
			private Button btHuy;
			private Button btLast;
			public string clrISN;
			private IContainer components;
			private string connStr;
			private DataGrid dataGrid1;
			private Database_Com db;
			private DataSet ds;
			public int flag;
			public string invISN;
			public string ISN;
			private Label label1;
			private Label label2;
			public string patID;
			public string patName;
			private TextBox tbGoTo;
			public string tienkham;
			public string tienphauthuat;
			public string tienthuoc;
			public string tienthuthuat;
			private ToolTip toolTip1;
			private TextBox txtReason;
		#endregion
		
		#region Constructors
		
			public frmXoaHD ()
			
			{
				this.flag = 1;
				this.db = new Database_Com ();
				this.InitializeComponent ();
				this.connStr = Connection.ConnectionString ();
				return;
			}
			
		#endregion
		
		#region Methods
		
			private void btExit_Click (object sender, EventArgs e)
			
			{
				base.Close ();
				return;
			}
			
			private void btFirst_Click (object sender, EventArgs e)
			
			{
				this.bmb.Position = 0;
				return;
			}
			
			private void btHuy_Click (object sender, EventArgs e)
			
			{
				string theString;
				string theString2;
				string theString3;
				SqlConnection theSqlConnection;
				string theString4;
				SqlCommand theSqlCommand;
				SqlParameter theSqlParameter;
				string[] theStringArray;
				string[] theStringArray2;
				string[] theStringArray3;
				SqlDbType[] theSqlDbTypeArray;
				object[] theObjectArray;
				if (this.txtReason.Text != "")
				{
					goto L_002F;
				}
				DialogResult theDialogResult = MessageBox.Show ("Vui l?ng nh?p l? do h?y!", "L?i Nh?p", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
				goto L_0254;
				
			L_002F:
				
				{
				}
				theString = this.ds.Tables["vw_FullPayment"].Rows[this.dataGrid1.CurrentRowIndex]["patName"].ToString ();
				theString2 = this.ds.Tables["vw_FullPayment"].Rows[this.dataGrid1.CurrentRowIndex]["clrISN"].ToString ();
				theString3 = this.ds.Tables["vw_FullPayment"].Rows[this.dataGrid1.CurrentRowIndex]["invISN"].ToString ();
				theStringArray = new string[5];
				theStringArray[0] = "B?n c? mu?n h?y h?a ??n c? m? b?nh ?n ";
				theStringArray[1] = theString2;
				theStringArray[2] = " c?a b?nh nh?n ";
				theStringArray[3] = theString;
				theStringArray[4] = " n?y kh?ng?";
				if (MessageBox.Show (string.Concat (theStringArray), "H?y H?a ??n", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
				{
					goto L_0254;
				}
				theSqlConnection = new SqlConnection (this.connStr);
				theString4 = Class.isn;
				theStringArray2 = new string[7];
				theStringArray2[0] = "Insert UserUpdatedInvoices values(";
				theStringArray2[1] = theString4;
				theStringArray2[2] = ",";
				theStringArray2[3] = theString3;
				theStringArray2[4] = ",getDate(),@lido,2,0, ";
				theStringArray2[5] = theString2;
				theStringArray2[6] = ")";
				theSqlCommand = new SqlCommand (string.Concat (theStringArray2), theSqlConnection);
				theSqlParameter = new SqlParameter ("@lido", SqlDbType.NVarChar);
				theSqlParameter.Value = this.txtReason.Text;
				SqlParameter theSqlParameter2 = theSqlCommand.Parameters.Add (theSqlParameter);
				theSqlCommand.Connection.Open ();
				int i = theSqlCommand.ExecuteNonQuery ();
				theSqlCommand.Connection.Close ();
				SqlConnection theSqlConnection2 = this.db.CreateConnections ();
				theStringArray3 = new string[1];
				theStringArray3[0] = "@clrISN";
				theSqlDbTypeArray = new SqlDbType[1];
				theSqlDbTypeArray[0] = SqlDbType.Int;
				theObjectArray = new object[1];
				theObjectArray[0] = theString2;
				this.db.ExecuteStoredProc ("sp_Invoices_Delete", theStringArray3, theSqlDbTypeArray, theObjectArray);
				DialogResult theDialogResult2 = MessageBox.Show (string.Concat ("?? h?y h?a ??n c? m? b?nh ?n :", theString2, " !"), "Th?ng B?o", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
				this.txtReason.Text = "";
				this.frmXoaHD_Load (sender, e);
				
			L_0254:
				return;
			}
			
			private void btLast_Click (object sender, EventArgs e)
			
			{
				this.bmb.Position = (this.ds.Tables["vw_FullPayment"].Rows.Count - 1);
				return;
			}
			
			protected override void Dispose (bool disposing)
			
			{
				this.flag = 0;
				if (! disposing)
				{
					goto L_001D;
				}
				if (this.components == null)
				{
					goto L_001D;
				}
				this.components.Dispose ();
				
			L_001D:
				
				{
				}
				base.Dispose (disposing);
				return;
			}
			
			private void frmXoaHD_Load (object sender, EventArgs e)
			
			{
				SqlConnection theSqlConnection;
				SqlDataAdapter theSqlDataAdapter;
				theSqlConnection = new SqlConnection (this.connStr);
				theSqlDataAdapter = new SqlDataAdapter ("Select * from  vw_FullPayment", theSqlConnection);
				this.ds = new DataSet ();
				int i = theSqlDataAdapter.Fill (this.ds, "vw_FullPayment");
				if ((this.ds != null) && ((this.ds.Tables.Count != 0) && (this.ds.Tables[0].Rows.Count != 0)))
				{
					goto L_0074;
				}
				
			L_006C:
				
				{
				}
				base.Close ();
				goto L_00D5;
				
			L_0074:
				
				{
				}
				this.dataGrid1.Enabled = true;
				this.dataGrid1.DataSource = this.ds;
				this.dataGrid1.SetDataBinding (this.ds, "vw_FullPayment");
				this.dataGrid1.ReadOnly = true;
				this.dataGrid1.TableStyles.Clear ();
				this.loadDataGrid ();
				theSqlDataAdapter.Dispose ();
				theSqlConnection.Close ();
				
			L_00D5:
				return;
			}
			
			private void InitializeComponent ()
			
			{
				ResourceManager theResourceManager;
				Control[] theControlArray;
				this.components = ((IContainer) new System.ComponentModel.Container ());
				theResourceManager = new ResourceManager (typeof (frmXoaHD));
				this.label1 = new Label ();
				this.dataGrid1 = new DataGrid ();
				this.btExit = new Button ();
				this.btFirst = new Button ();
				this.toolTip1 = new ToolTip (this.components);
				this.btLast = new Button ();
				this.tbGoTo = new TextBox ();
				this.btHuy = new Button ();
				this.txtReason = new TextBox ();
				this.label2 = new Label ();
				((ISupportInitialize) this.dataGrid1).BeginInit ();
				base.SuspendLayout ();
				this.label1.Font = new System.Drawing.Font ("Verdana", 12F, FontStyle.Bold, GraphicsUnit.Point, ((byte) byte.MinValue));
				this.label1.ForeColor = Color.MediumBlue;
				this.label1.Location = new Point (304, 13);
				this.label1.Name = "label1";
				this.label1.Size = new System.Drawing.Size (128, 23);
				this.label1.TabIndex = 0;
				this.label1.Text = "H?y H?a ??n";
				this.label1.TextAlign = ContentAlignment.MiddleCenter;
				this.dataGrid1.BackgroundColor = SystemColors.ActiveCaptionText;
				this.dataGrid1.CaptionVisible = false;
				this.dataGrid1.DataMember = "";
				this.dataGrid1.HeaderForeColor = SystemColors.ControlText;
				this.dataGrid1.Location = new Point (16, 50);
				this.dataGrid1.Name = "dataGrid1";
				this.dataGrid1.Size = new System.Drawing.Size (688, 312);
				this.dataGrid1.TabIndex = 4;
				this.btExit.FlatStyle = FlatStyle.Popup;
				this.btExit.Location = new Point (616, 369);
				this.btExit.Name = "btExit";
				this.btExit.Size = new System.Drawing.Size (88, 23);
				this.btExit.TabIndex = 8;
				this.btExit.Text = "Tho?t";
				this.btExit.Click += new EventHandler (this.btExit_Click);
				this.btFirst.FlatStyle = FlatStyle.Popup;
				this.btFirst.Image = ((Image) ((Bitmap) theResourceManager.GetObject ("btFirst.Image")));
				this.btFirst.Location = new Point (16, 370);
				this.btFirst.Name = "btFirst";
				this.btFirst.Size = new System.Drawing.Size (24, 23);
				this.btFirst.TabIndex = 10;
				this.toolTip1.SetToolTip (((Control) this.btFirst), "Di chuy?n ??n m?u tin ??u ti?n");
				this.btFirst.Click += new EventHandler (this.btFirst_Click);
				this.btLast.FlatStyle = FlatStyle.Popup;
				this.btLast.Image = ((Image) ((Bitmap) theResourceManager.GetObject ("btLast.Image")));
				this.btLast.Location = new Point (120, 370);
				this.btLast.Name = "btLast";
				this.btLast.Size = new System.Drawing.Size (24, 23);
				this.btLast.TabIndex = 11;
				this.toolTip1.SetToolTip (((Control) this.btLast), "Di chuy?n ??n m?u tin cu?i c?ng");
				this.btLast.Click += new EventHandler (this.btLast_Click);
				this.tbGoTo.BorderStyle = BorderStyle.FixedSingle;
				this.tbGoTo.Location = new Point (48, 370);
				this.tbGoTo.Name = "tbGoTo";
				this.tbGoTo.Size = new System.Drawing.Size (64, 23);
				this.tbGoTo.TabIndex = 12;
				this.tbGoTo.Text = "";
				this.tbGoTo.TextChanged += new EventHandler (this.tbGoTo_TextChanged);
				this.btHuy.FlatStyle = FlatStyle.Popup;
				this.btHuy.Location = new Point (520, 369);
				this.btHuy.Name = "btHuy";
				this.btHuy.Size = new System.Drawing.Size (88, 23);
				this.btHuy.TabIndex = 13;
				this.btHuy.Text = "H?y";
				this.btHuy.Click += new EventHandler (this.btHuy_Click);
				this.txtReason.BorderStyle = BorderStyle.FixedSingle;
				this.txtReason.Location = new Point (249, 370);
				this.txtReason.Multiline = true;
				this.txtReason.Name = "txtReason";
				this.txtReason.ScrollBars = ScrollBars.Vertical;
				this.txtReason.Size = new System.Drawing.Size (240, 23);
				this.txtReason.TabIndex = 14;
				this.txtReason.Text = "";
				this.label2.Location = new Point (178, 376);
				this.label2.Name = "label2";
				this.label2.Size = new System.Drawing.Size (80, 23);
				this.label2.TabIndex = 15;
				this.label2.Text = "L? do h?y:";
				this.AutoScaleBaseSize = new System.Drawing.Size (7, 16);
				base.ClientSize = new System.Drawing.Size (718, 395);
				theControlArray = new Control[9];
				theControlArray[0] = ((Control) this.txtReason);
				theControlArray[1] = ((Control) this.label2);
				theControlArray[2] = ((Control) this.btHuy);
				theControlArray[3] = ((Control) this.tbGoTo);
				theControlArray[4] = ((Control) this.btLast);
				theControlArray[5] = ((Control) this.btFirst);
				theControlArray[6] = ((Control) this.btExit);
				theControlArray[7] = ((Control) this.dataGrid1);
				theControlArray[8] = ((Control) this.label1);
				base.Controls.AddRange (theControlArray);
				this.Font = new System.Drawing.Font ("Verdana", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte) byte.MinValue));
				base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
				base.Icon = ((System.Drawing.Icon) theResourceManager.GetObject ("$this.Icon"));
				base.MaximizeBox = false;
				base.MinimizeBox = false;
				base.Name = "frmXoaHD";
				base.StartPosition = FormStartPosition.CenterScreen;
				this.Text = "H?y H?a ??n";
				base.TopMost = true;
				base.Load += new EventHandler (this.frmXoaHD_Load);
				((ISupportInitialize) this.dataGrid1).EndInit ();
				base.ResumeLayout (false);
				return;
			}
			
			public bool IsNumber (string Number)
			
			{
				bool theBoolean;
				
			L_0000:
				try
				{
					long theLong = long.Parse (Number);
					theBoolean = true;
				}
				catch
				{
					
				L_000B:
					
					{
					}
					theBoolean = false;
				}
				
			L_0010:
				
				{
				}
				return theBoolean;
			}
			
			public void loadDataGrid ()
			
			{
				DataGridTableStyle theDataGridTableStyle;
				DataGridTextBoxColumn theDataGridTextBoxColumn;
				DataGridTextBoxColumn theDataGridTextBoxColumn2;
				DataGridTextBoxColumn theDataGridTextBoxColumn3;
				DataGridTextBoxColumn theDataGridTextBoxColumn4;
				DataGridTextBoxColumn theDataGridTextBoxColumn5;
				DataGridTextBoxColumn theDataGridTextBoxColumn6;
				DataGridTextBoxColumn theDataGridTextBoxColumn7;
				DataGridTextBoxColumn theDataGridTextBoxColumn8;
				DataGridTextBoxColumn theDataGridTextBoxColumn9;
				DataGridTextBoxColumn theDataGridTextBoxColumn10;
				DataGridTextBoxColumn theDataGridTextBoxColumn11;
				theDataGridTableStyle = new DataGridTableStyle ();
				theDataGridTableStyle.MappingName = "vw_FullPayment";
				theDataGridTableStyle.AlternatingBackColor = Color.AliceBlue;
				theDataGridTableStyle.HeaderForeColor = Color.Maroon;
				theDataGridTableStyle.GridLineColor = Color.CornflowerBlue;
				theDataGridTextBoxColumn = new DataGridTextBoxColumn ();
				theDataGridTextBoxColumn.MappingName = "clrISN";
				theDataGridTextBoxColumn.HeaderText = "";
				theDataGridTextBoxColumn.Width = 0;
				int i = theDataGridTableStyle.GridColumnStyles.Add (((DataGridColumnStyle) theDataGridTextBoxColumn));
				theDataGridTextBoxColumn2 = new DataGridTextBoxColumn ();
				theDataGridTextBoxColumn2.MappingName = "invISN";
				theDataGridTextBoxColumn2.HeaderText = "";
				theDataGridTextBoxColumn2.Width = 0;
				int i2 = theDataGridTableStyle.GridColumnStyles.Add (((DataGridColumnStyle) theDataGridTextBoxColumn2));
				theDataGridTextBoxColumn3 = new DataGridTextBoxColumn ();
				theDataGridTextBoxColumn3.MappingName = "patID";
				theDataGridTextBoxColumn3.HeaderText = "S? ID";
				theDataGridTextBoxColumn3.Width = 110;
				int i3 = theDataGridTableStyle.GridColumnStyles.Add (((DataGridColumnStyle) theDataGridTextBoxColumn3));
				theDataGridTextBoxColumn4 = new DataGridTextBoxColumn ();
				theDataGridTextBoxColumn4.MappingName = "patName";
				theDataGridTextBoxColumn4.HeaderText = "T?n B?nh Nh?n";
				theDataGridTextBoxColumn4.Width = 210;
				int i4 = theDataGridTableStyle.GridColumnStyles.Add (((DataGridColumnStyle) theDataGridTextBoxColumn4));
				theDataGridTextBoxColumn5 = new DataGridTextBoxColumn ();
				theDataGridTextBoxColumn5.MappingName = "patBirthDate";
				theDataGridTextBoxColumn5.HeaderText = "Ng?y Sinh";
				theDataGridTextBoxColumn5.Width = 100;
				int i5 = theDataGridTableStyle.GridColumnStyles.Add (((DataGridColumnStyle) theDataGridTextBoxColumn5));
				theDataGridTextBoxColumn6 = new DataGridTextBoxColumn ();
				theDataGridTextBoxColumn6.MappingName = "clrExaminationDate";
				theDataGridTextBoxColumn6.HeaderText = "Ng?y L?p B?nh ?n";
				theDataGridTextBoxColumn6.Width = 131;
				theDataGridTextBoxColumn6.NullText = string.Empty;
				int i6 = theDataGridTableStyle.GridColumnStyles.Add (((DataGridColumnStyle) theDataGridTextBoxColumn6));
				theDataGridTextBoxColumn7 = new DataGridTextBoxColumn ();
				theDataGridTextBoxColumn7.MappingName = "clrExaminationTimes";
				theDataGridTextBoxColumn7.HeaderText = "L?n Kh?m";
				theDataGridTextBoxColumn7.Width = 131;
				theDataGridTextBoxColumn7.NullText = string.Empty;
				int i7 = theDataGridTableStyle.GridColumnStyles.Add (((DataGridColumnStyle) theDataGridTextBoxColumn7));
				theDataGridTextBoxColumn8 = new DataGridTextBoxColumn ();
				theDataGridTextBoxColumn8.MappingName = "invExaminationPayment";
				theDataGridTextBoxColumn8.HeaderText = "Ti?n Kh?m";
				theDataGridTextBoxColumn8.Width = 131;
				theDataGridTextBoxColumn8.NullText = string.Empty;
				int i8 = theDataGridTableStyle.GridColumnStyles.Add (((DataGridColumnStyle) theDataGridTextBoxColumn8));
				theDataGridTextBoxColumn9 = new DataGridTextBoxColumn ();
				theDataGridTextBoxColumn9.MappingName = "invMedicinePayment";
				theDataGridTextBoxColumn9.HeaderText = "Ti?n Thu?c";
				theDataGridTextBoxColumn9.Width = 131;
				theDataGridTextBoxColumn9.NullText = string.Empty;
				int i9 = theDataGridTableStyle.GridColumnStyles.Add (((DataGridColumnStyle) theDataGridTextBoxColumn9));
				theDataGridTextBoxColumn10 = new DataGridTextBoxColumn ();
				theDataGridTextBoxColumn10.MappingName = "invMedicineSkillPayment";
				theDataGridTextBoxColumn10.HeaderText = "Ti?n Th? Thu?t";
				theDataGridTextBoxColumn10.Width = 131;
				theDataGridTextBoxColumn10.NullText = string.Empty;
				int i10 = theDataGridTableStyle.GridColumnStyles.Add (((DataGridColumnStyle) theDataGridTextBoxColumn10));
				theDataGridTextBoxColumn11 = new DataGridTextBoxColumn ();
				theDataGridTextBoxColumn11.MappingName = "invSurgeryPayment";
				theDataGridTextBoxColumn11.HeaderText = "Ti?n Ph?u Thu?t";
				theDataGridTextBoxColumn11.Width = 131;
				theDataGridTextBoxColumn11.NullText = string.Empty;
				int i11 = theDataGridTableStyle.GridColumnStyles.Add (((DataGridColumnStyle) theDataGridTextBoxColumn11));
				theDataGridTableStyle.AllowSorting = false;
				int i12 = this.dataGrid1.TableStyles.Add (theDataGridTableStyle);
				this.bmb = this.BindingContext[this.dataGrid1.DataSource, this.dataGrid1.DataMember];
				return;
			}
			
			private void tbGoTo_TextChanged (object sender, EventArgs e)
			
			{
				int i;
				if (! this.IsNumber (this.tbGoTo.Text.ToString ()))
				{
					goto L_0094;
				}
				i = 0;
				goto L_0070;
				
			L_001C:
				
				{
				}
				if (this.ds.Tables["vw_FullPayment"].Rows[i][1].ToString () != this.tbGoTo.Text.ToString ())
				{
					goto L_006C;
				}
				this.bmb.Position = i;
				goto L_0092;
				
			L_006C:
				
				{
				}
				i++;
				
			L_0070:
				
				{
				}
				if (i < this.ds.Tables["vw_FullPayment"].Rows.Count)
				{
					goto L_001C;
				}
				
			L_0092:
				
				{
				}
				goto L_009F;
				
			L_0094:
				
				{
				}
				this.tbGoTo.SelectAll ();
				
			L_009F:
				return;
			}
			
			private void tbKeySearch_KeyPress (object sender, KeyPressEventArgs e)
			
			{
				return;
			}
			
		#endregion
	}
	
}

